// 交易总路由 见 trade文件夹
const routes = [
    { path: '/market', component: MARKET,name:'market' },
    { path: '/trade', component: TRADE,name:'trade'},
    { path: '/order', component: ORDER,name:'order' },
    { path: '/history', component: HISTORY,name:'history'},
]
const router = new VueRouter({
    routes:routes
})
var vue;
function vue_init(coin_type, use_coin_type) {
//    console.log(" 11111" )
    dict.coin_type = coin_type,
    dict.use_coin_type = use_coin_type,
    vue = new Vue({
        router,
        //delimiters:['{!', '!}'],
        data:{
            select_tab:'trade',
            transitionName: 'slide-left',
            coin_type: coin_type,
            use_coin_type: use_coin_type,
        },
        methods:{
            init:function () {
                //console.log(this.$route.name)
                this.select_tab=this.$route.name;
            },
            sel_page:function (page) {
                this.select_tab=page;
                //console.log(page);
            },

        },
        watch: {
            '$route':function(to, from) {
                //console.log(to,from);
                //const toDepth = to.path.split('/').length;
                //const fromDepth = from.path.split('/').length;
                //console.log(toDepth,fromDepth);
                this.sel_page(to.name);
                if(from.name=='market') {
                    this.transitionName='slide-left';
                } else if(from.name=='trade') {
                    if(to.name=='market'){
                        this.transitionName='slide-right';
                    }else {
                        this.transitionName='slide-left';
                    }
                    }else if(from.name=='order'){
                        this.transitionName='slide-right';
                    }
                    //this.transitionName = toDepth < fromDepth ? 'slide-right' : 'slide-left';
                    //console.log(this.transitionName);
                }
            },

        }).$mount('#market-app')
        vue.init();
    }

